From 1dbb8df95f4732342c3ae279adea98da13238452 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 4 Jul 2020 17:02:44 +0200 Subject: [PATCH] stringlist: Export gtk_string_object_new() There are various use cases where it makes sense to construct these - from our internal testing to using them in flatten- or mapmodels. --- docs/reference/gtk/gtk4-sections.txt | 2 ++ gtk/gtkstringlist.c | 10 +++++++++- gtk/gtkstringlist.h | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 437092116c..c6da63ac74 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -7611,7 +7611,9 @@ gtk_string_list_take gtk_string_list_remove gtk_string_list_splice gtk_string_list_get_string + GtkStringObject +gtk_string_object_new gtk_string_object_get_string diff --git a/gtk/gtkstringlist.c b/gtk/gtkstringlist.c index 608081d500..2555e1f8f3 100644 --- a/gtk/gtkstringlist.c +++ b/gtk/gtkstringlist.c @@ -156,7 +156,15 @@ gtk_string_object_new_take (char *string) return obj; } -static GtkStringObject * +/** + * gtk_string_object_new: + * @string: (non-nullable): The string to wrap + * + * Wraps a string in an object for use with #GListModel + * + * Returns: a new #GtkStringObject + **/ +GtkStringObject * gtk_string_object_new (const char *string) { return gtk_string_object_new_take (g_strdup (string)); diff --git a/gtk/gtkstringlist.h b/gtk/gtkstringlist.h index 17be87864b..c426a91542 100644 --- a/gtk/gtkstringlist.h +++ b/gtk/gtkstringlist.h @@ -37,7 +37,9 @@ GDK_AVAILABLE_IN_ALL G_DECLARE_FINAL_TYPE (GtkStringObject, gtk_string_object, GTK, STRING_OBJECT, GObject) GDK_AVAILABLE_IN_ALL -const char * gtk_string_object_get_string (GtkStringObject *self); +GtkStringObject * gtk_string_object_new (const char *string); +GDK_AVAILABLE_IN_ALL +const char * gtk_string_object_get_string (GtkStringObject *self); #define GTK_TYPE_STRING_LIST (gtk_string_list_get_type ()) -- 2.30.2